package com.ticket.system.domain.enu;

import lombok.Getter;

@Getter
public enum IdTypeEnum {

    ONE(0,"未知"),
    TWO(1,"身份证"),
    THREE(2,"护照"),
    FOUR(3,"港澳台通行证及居住证"),
    def(99,"");


    private final int code;

    private final String value;

    IdTypeEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }

    public static IdTypeEnum indexOf(Integer code) {
        if(code==null){
            return def;
        }
        for (IdTypeEnum obj : IdTypeEnum.values()) {
            if (code.equals(obj.getCode())) {
                return obj;
            }
        }
        return null;
    }

    public static IdTypeEnum indexOfMsg(String msg) {
        for (IdTypeEnum obj : IdTypeEnum.values()) {
            if (msg.equals(obj.getValue())) {
                return obj;
            }
        }
        return null;
    }
}
